package com.dingding.quartz;

import org.apache.log4j.Logger;

import com.dingding.bean.databean.response.DataResponse;
import com.dingding.service.BaseService;

/**
 * @ClassName: QuartzJob
 * @Description: 触发器执行类
 * @author cheshaowei
 * @date 2015-12-1 下午07:56:55
 */
public class DingDingQuartzJob extends BaseService {

	
	private static final Logger log = Logger.getLogger(DingDingQuartzJob.class);
	/**
	 * 
	 * @Title: cancelOrder
	 * @Description:自动取消订单
	 * @author cheshaowei
	 * @throws
	 * 
	 */
	public void cancelOrderOrautoArrival() {
		
		super.userOrderTService.automaticCancel();
		//批量将待取消订单添加到userOrder表中(自动取消订单)
		boolean batchHandle = userOrderTService.batchHandle();
		if(batchHandle){
			//批量删除待取消订单(自动取消订单)
			userOrderTService.batchDelete();
		}
		
		
		super.userOrderService.automaticConfirmArrival();
		//批量将自动完成订单添加值userOrder表中
		boolean flag = super.userOrderService.batchConfirmArrival();
		if(flag){
			//批量处理自动完成订单
			super.userOrderService.batchDeleteConfirmArrival();
		}
	}

	/**
	 * 
	 * @Title: confirmArrival
	 * @Description:自动确认到达
	 * @author cheshaowei
	 * @throws
	 */
	public void confirmArrival() {
		
		super.userOrderService.automaticConfirmArrival();
		
		super.userOrderService.batchConfirmArrival();
		
		super.userOrderService.batchDeleteConfirmArrival();
		
	}

	/**
	 * 
	 * @Title: reset
	 * @Description:重置每日完成订单次数、取消订单次数、提现次数
	 * @author cheshaowei
	 * @throws
	 */
	public void reset() {
		
		log.info("执行重置每日完成订单次数、取消订单次数、提现次数！");
		super.userLoginService.resetOrderNumber();

	}
	
	
	/**
	 * @Description: 把每天推广商统计的微信公众号关注数存入总数
	 * @author fengshuonan
	 * @return void
	 */
	public void recordDayAttendNum(){
		
		log.info("执行：把每天推广商统计的微信公众号关注数存入总数！");
		super.wechatActivityService.recordDayAttendNum();
	}
	

	@Override
	public void setStatus(DataResponse dataResponse, int status) {
	}

}
